﻿#include "systemsetting_4.h"
#include "ui_systemsetting_4.h"

SystemSetting_4::SystemSetting_4(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SystemSetting_4)
{
    ui->setupUi(this);
    time = new QLabel(ui->frameBottom);
    time->setGeometry(10, 10, 200, 40);
    time->setStyleSheet("QLabel{font: 20px; color: rgb(25, 25, 112);}");
    signal = new QLabel(ui->frameBottom);
    signal->setGeometry(700, 18, 41, 22);
    signal->setStyleSheet("QLabel{background-color:transparent;}");

    QDir dir(IMAGE_PATH);
    if(dir.exists())
    {
        ui->frameTop->setStyleSheet(LOGO_STY);
    }

    version = TCU_VERSION1;
#if   (PRODUCER == 0)
    version.append(TCU_VERSION2_0);
#elif (PRODUCER == 1)
    version.append(TCU_VERSION2_1);
#elif (PRODUCER == 2)
    version.append(TCU_VERSION2_2);
#elif (PRODUCER == 3)
    version.append(TCU_VERSION2_3);
#elif (PRODUCER == 4)
    version.append(TCU_VERSION2_4);
#elif (PRODUCER == 5)
    version.append(TCU_VERSION2_5);
#elif (PRODUCER == 6)
    version.append(TCU_VERSION2_6);
#endif
    version.append(QString::number(GUN_AMOUNT));

#if   (PRODUCER == 0)
    version.append(TCU_VERSION3_0);
#elif (PRODUCER == 1)
    version.append(TCU_VERSION3_1);
#elif (PRODUCER == 2)
    version.append(TCU_VERSION3_2);
#elif (PRODUCER == 3)
    version.append(TCU_VERSION3_3);
#elif (PRODUCER == 4)
    version.append(TCU_VERSION3_4);
#elif (PRODUCER == 5)
    version.append(TCU_VERSION3_5);
#elif (PRODUCER == 6)
    version.append(TCU_VERSION3_6);
#endif
    // QString MainVersion = readFile(QString(CHARGE_CONF), QString("MAIN_VER"));
    // version.append(QString(".") + MainVersion);
    ui->lineEditFactory->setText(version);

}


void SystemSetting_4::on_buttonBack_clicked()
{
    /*待完成*/
    stackLayout->setCurrentIndex(ChooseGunPage);
}

void SystemSetting_4::on_buttonPrev_clicked()
{
    stackLayout->setCurrentIndex(SystemSetting3Page);
}

void SystemSetting_4::on_buttonExportData_clicked()
{
    stackLayout->setCurrentIndex(exportRecordOfChargePage);
}

void SystemSetting_4::on_buttonSearchManageCard_clicked()
{
    emit RequestIntoChargeManageCardPage();
}

void SystemSetting_4::on_buttonChargRecord_clicked()
{
    /*待完成*/
    stackLayout->setCurrentIndex(recordOfChargePage);
}

void SystemSetting_4::on_buttonFaultRecord_clicked()
{
    /*待完成*/
    stackLayout->setCurrentIndex(warningInfoPage);
}

SystemSetting_4::~SystemSetting_4()
{
    delete ui;
}

void SystemSetting_4::on_buttonGunInfoSetting_clicked()
{
    stackLayout->setCurrentIndex(GuninfoSettingPage);
}

void SystemSetting_4::on_LOGENABLE_to_1_clicked()
{
    writeFile(QString(CHARGE_CONF), QString("LOGENABLE"), "1");
}

void SystemSetting_4::on_buttonSetRate_clicked()
{
    stackLayout->setCurrentIndex(SetRatePage);
}
